package com.md.api;

import com.md.model.system.CommonResult;
import com.md.request.QueryLogsRequest;
import com.md.request.QueryLogsTreeRequest;
import com.md.response.LogsTreeResponse;
import com.md.response.QueryLogsResponse;
import com.md.response.SimplifyLogsTreeResponse;
import com.md.value.constants.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author 刘骄阳
 * 2022-06-12 2:09
 */
@Api(tags = {ApiConstants.LOGS})
public interface LogsApi {
  String PATH_PREFIX = "/logs";

  /**
   * 分页查询日志
   *
   * @param request 请求实体
   * @return 操作结果
   */
  @PostMapping(PATH_PREFIX + "/select/page")
  @ApiOperation("分页查询日志")
  CommonResult<QueryLogsResponse> selectPage(@RequestBody QueryLogsRequest request);

  /**
   * 查询请求链路
   *
   * @param request 请求实体
   * @return 操作结果
   */
  @PostMapping(PATH_PREFIX + "/select/tree")
  @ApiOperation("查询请求链路")
  CommonResult<LogsTreeResponse> selectTree(@RequestBody @Validated QueryLogsTreeRequest request);

  /**
   * 查询请求链路映射
   *
   * @param request 请求实体
   * @return 操作结果
   */
  @PostMapping(PATH_PREFIX + "/select/tree/map")
  @ApiOperation("查询请求链路映射")
  CommonResult<SimplifyLogsTreeResponse> selectTreeMap(@RequestBody @Validated QueryLogsTreeRequest request);
}
